package io.renren.modules.medical.controller;

import io.renren.common.result.Result;
import io.renren.modules.medical.service.FileService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 公共的接口
 * 1、文件上传
 * @author Luo Sheng
 * @school YiBin university
 * @create 2023-04-12 17:14
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/medical/common")
public class CommonController {

    private final FileService fileService;

    @PostMapping("/fileUpload")
    public Result<String> upload(@RequestParam("file") MultipartFile file){
        String resultUrl = fileService.upload(file);
        return Result.success(resultUrl);
    }
}
